package com.example.hotel.service.impl;

import com.example.hotel.dao.UserDao;
import com.example.hotel.pojo.User;
import com.example.hotel.service.UserService;
import com.example.hotel.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userdao;
    @Override
    public User findByUserName(String username) {
        User user = userdao.findByUserName(username);
        return user;
    }

    @Override
    public void register(String username, String password) {
        //加密
        String md5String = Md5Util.getMD5String(password);
        //添加用户
        userdao.addUser(username,md5String);
    }

}
